package edu.zut.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class MailSendUtil {


    @Resource
    private JavaMailSender mailSender;

    @Value("${my.email}")
    private String from;

    public void send(String email,String zym){
        SimpleMailMessage mailMessage = new SimpleMailMessage();
        mailMessage.setFrom(from);
        mailMessage.setSubject("验证码");
        mailMessage.setTo(email);
        mailMessage.setText(zym);
        mailSender.send(mailMessage);
    }


}
